<extend name="Base/common"/>
<block name="header">
    <include file="Public/nav"/>
</block>
<block name="body">
    <script src="__JS__/appstore.js"></script>
    <!--模板详情-->
    <div class="container">
        <div class="clearfix">

            <div class="clearfix">
                <div class="col-xs-9">
                    <div class="common-block">
                        <div class="col-xs-3 text-center">
                            {$data.cover|display_cover=160,160,'-detail'}
                        </div>
                        <div class="col-xs-9">
                            <article class="article">
                                <header>
                                    <h1 class="text-center">{$data.title|text} <div class="pull-right">
                                        {:W('Appstore/Watch/render',array($data))}&nbsp;&nbsp;
                                        {:W('Weibo/Share/shareBtn',array('param'=>array('title'=>$data['title'],'content'=>$data['ad'],'img'=>getThumbImageById($data['cover'],160,160),'from'=>$MODULE_ALIAS,'site_link'=>U('appstore/index/plugindetail',array('id'=>$data['id']))),'text'=>'<span class="share-btn"><i class="icon-share"></i> </span>'))}</div>
                                    </h1>
                                    <dl class="dl-inline">
                                        <dt>上架时间：</dt>
                                        <dd>{$data.update_time|date='Y-m-d',###}</dd>

                                        <dt></dt>

                                    </dl>


                                    <dl class="dl-inline" style="position: relative">
                                        <dt>
                                            服务商
                                        </dt>
                                        <dd>
                                            <a href="{$data.user.space_url}">{$data.user.nickname}</a>
                                        </dd>


                                    </dl>
                                    <if condition="check_auth('Appstore/Admin/manage') OR $data['uid'] eq is_login()">
                                        <div class="pull-right" ><a href="{:U('admin/addservice',array('id'=>$data['id']))}">编辑</a></div>
                                    </if>
                                </header>
                                <div class="article-content">
                                    <!--详情图片和简略信息-->
                                    <div class=" tem_line_1 plug_item">
                                        <div class="">

                                        </div>


                                    </div>
                                </div>

                            </article>
                        </div>

                        <div>
                            <table class="mb10 col-md-12 table" style="text-align: left">
                                <colgroup>
                                    <col width="200">
                                    <col width="200">
                                    <col width="220">
                                </colgroup>
                                <thead>
                                <tr class="first_tr">
                                    <th style="background: transparent;border-top: 1px solid #ddd">方案名</th>

                                    <th style="background: transparent;border-top: 1px solid #ddd">售价</th>
                                    <th style="background: transparent;border-top: 1px solid #ddd">销量</th>
                                    <th style="background: transparent;border-top: 1px solid #ddd">购买</th>
                                </tr>
                                </thead>
                                <tbody>
                                <if condition="$data['uid'] eq is_login()">
                                    <tr>
                                        <td colspan="5">
                                            <a class="btn btn-success"
                                               href="{:U('admin/addsolution',array('id'=>$data['id']))}"
                                               style="width: 100%">添加新方案</a>
                                        </td>
                                    </tr>
                                </if>
                                <volist name="versions" id="vo">
                                    <tr>
                                        <td class="text-left version_title">
                                            <a href="javascript:" class="version_title"
                                            <if condition="check_auth('Appstore/Admin/manage',$data['uid'])">
                                                data-edit-url="{:U('appstore/admin/editVersion',array('id'=>$vo['id']))}"
                                                data-del-url="{:U('appstore/admin/delVersion',array('id'=>$vo['id']))}"
                                            </if>
                                            >  {$vo.title} </a>
                                        </td>

                                        <td class="text-left">{$vo.id|display_fee}</td>
                                        <td>{$vo.sales}</td>
                                        <td>
                                            {$vo.id|display_buy}
                                        </td>
                                    </tr>
                                </volist>
                            </table>

                            <script>
                                $(function () {
                                    $('.version_title').each(function () {
                                        var editUrl = $(this).attr('data-edit-url');
                                        var delUrl = $(this).attr('data-del-url');

                                        var editHtml = '';
                                        var delHtml = '';
                                        var flag = '';
                                        if (typeof editUrl != 'undefined') {
                                            editHtml = '<a href="' + $(this).attr('data-edit-url') + '">编辑</a>';
                                        }
                                        if (typeof delUrl != 'undefined') {
                                            delHtml = '<a href="' + $(this).attr('data-del-url') + '">删除</a>';
                                        }
                                        if (editHtml != '' && delHtml != '') {
                                            flag = ' | '
                                        }
                                        $(this).popover({content:editHtml+flag+delHtml, trigger: 'click', placement: 'left', html: true})
                                    })
                                })
                            </script>
                        </div>
                        <include file="_detail_service_comment"/>


                    </div>
                </div>


                <div class="col-xs-3 ">
                    <div class="common-block">
                        <include file="Index/_side"/>
                    </div>
                </div>
            </div>


        </div>
    </div>


</block>